Variables¶

go_color.py¶

NOTES

  • go takes two arguments: Bit, and the color to paint
  • When you call go, you need to pass a value for bit and a value for color
    • The arguments are separated by a comma

color_variables.py¶

NOTES

New syntax: variable assignment

first_color = 'red'

Similar to how a function can define variables in the function definition, you can define your own variables anywhere you want.

You give these variables a value using the = character, known as the assignment operator.

Helpful Bit Fact¶

Bit can return the name of the color of the square Bit is on with

bit.get_color()

fill_colorful.py¶

NOTES

  • new syntax: assigning a variable a value returned from a function
    • color = bit.get_color()
    • color is assigned whatever value bit.get_color() returns

👨🏽‍🎨 Color T¶

color_tt.py¶

👨🏽‍🎨 sky.py¶

Key Ideas¶

  • Functions with multiple arguments
  • Variables
    • Assigning a static value (e.g. color = 'blue')
    • Assigning a value returned from a function (e.g. color = bit.get_color())